
#include "Grid.h"
#include "GridInterpolation.h"

Grid* Grid::vGrid;
Grid::_Particle Grid::Particle;

void Grid::wbSetPos(Vector3& gap){

	startPos = pos - gap/2;
	endPos = pos + gap/2;

	ptcCenter = pos;



}//void SetPos()

int Grid::wbSetnumber(){

	return numParticle = particle.size();

	
}//void Setnumber()


void Grid::_wbCalculateParticleDistribution() {

	auto end = particle.end();
	Vector3 center;

	int num = particle.size();
	
	for (auto it= particle.begin(); it != end; it++) 
		center += **it;
	center /= num;

	Vector3 var;
	float dist = 0.0f;
	for (auto it= particle.begin(); it != end; it++) {
		Vector3 d = **it - center;
		var += d;
		dist += d.length();
	}
	dist /= num;
}



